package com.milhouz.bomberrokon.events;

import java.util.HashMap;

public class Event {

	public static final int MOVE_EVENT = 1;
	public static final int DROP_BOMB_EVENT = 2;
	public static final int EXPLOSE_BOMB_EVENT = 3;
	public static final int KILL_BOMBER_EVENT = 4;
	public static final int START_ROUND_EVENT = 5;
	public static final int END_ROUND_EVENT = 6;

	public int type;

	private HashMap<String, String> mStringData;
	private HashMap<String, Integer> mIntegerData;

	public Event(int type) {
		this.type = type;
	}

	public void addStringParameter(String key, String value) {
		if (mStringData == null) {
			mStringData = new HashMap<String, String>();
		}
		mStringData.put(key, value);
	}

	public void addIntegerParameter(String key, Integer value) {
		if (mIntegerData == null) {
			mIntegerData = new HashMap<String, Integer>();
		}
		mIntegerData.put(key, value);
	}

	public HashMap<String, String> getStringData() {
		return mStringData;
	}

	public HashMap<String, Integer> getIntegerData() {
		return mIntegerData;
	}

	public String getStringParam(String key) {
		if (!mStringData.isEmpty()) {
			return mStringData.get(key);
		} else {
			return null;
		}
	}

	public Integer getIntParam(String key) {
		if (!mIntegerData.isEmpty()) {
			return mIntegerData.get(key);
		} else {
			return null;
		}
	}

	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer("Event type = ").append(type) //
				.append(" \n - String params  : ").append(mStringData) //
				.append(" \n - Integer params : ").append(mIntegerData);
		return sb.toString();
	}

}
